package cn.kgc.itrip.controller;

import cn.kgc.itrip.dto.Dto;
import cn.kgc.itrip.service.roomService.HotelRoomService;
import cn.kgc.itrip.vo.ItripLabelDicVO;
import cn.kgc.itrip.vo.hotelroom.ItripHotelRoomVO;
import cn.kgc.itrip.vo.hotelroom.SearchHotelRoomVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: love_travel
 * @description: 酒店房间查询
 * @author: Mr.Wang
 * @create: 2020-03-30 13:51
 **/


@RestController
@RequestMapping("/api/hotelroom")
public class HotelRoomController {

    @Resource
    private HotelRoomService hotelRoomService;

    /**
     *  根据targetId查询酒店房型图片(type=1)
     * @param targeId
     * @return
     */
    @GetMapping(value = "/getimg/{targetId}",consumes = "application/json",produces = "application/json")
    public Dto GetImg(@PathVariable String targeId){
        Dto dto=null;
        dto=hotelRoomService.findRoomImg(targeId);
        return dto;
    }

    /**
     * 查询酒店房间床型列表
     * @return
     */
    @GetMapping("/queryhotelroombed")
    public Dto<ItripLabelDicVO> queryHotelRoombed(){
        Dto dto=null;
        dto=hotelRoomService.findHotelRoombed();
        return dto;
    }

    /**
     * 查询酒店房间列表
     * @param roomVO
     * @return
     */
    @PostMapping(value = "/queryhotelroombyhotel",produces = "application/json")
    public Dto<ItripHotelRoomVO> queryHotelRoomByHotel(@RequestBody SearchHotelRoomVO roomVO){
        Dto dto=null;
        try {
            dto=hotelRoomService.HotelRoomByHotel(roomVO);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dto;
    }
}
